package yqlweb.util;

import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Querys {

    private String yqlApiUrl = "http://query.yahooapis.com/v1/public/yql";
    private HTMLEncoding coder = new HTMLEncoding();
    private Request req;

    public InputStream getResponse(String yqlStatement) {
        try {
            String myQuery = yqlApiUrl + "?q=" + coder.encode(yqlStatement) + "&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
            req = new Request();
            return req.request(myQuery);
        } catch (Exception ex) {
            Logger.getLogger(Querys.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }

    }
}
